load("@batfish//skylark:junit.bzl", "junit_tests")
load("@batfish//skylark:pmd_test.bzl", "pmd_test")
load("@rules_java//java:defs.bzl", "java_library")

package(
    default_testonly = True,
    default_visibility = ["//visibility:public"],
)

java_library(
    name = "coordinator_testlib",
    testonly = True,
    srcs = glob(
        ["**/*.java"],
        exclude = ["**/*Test.java"],
    ),
    deps = [
        "//projects/batfish-common-protocol:common",
        "//projects/batfish-common-protocol/src/test/java/org/batfish/datamodel/questions:TestQuestion",
        "//projects/coordinator",
        "@maven//:com_google_code_findbugs_jsr305",
        "@maven//:com_google_guava_guava",
        "@maven//:jakarta_ws_rs_jakarta_ws_rs_api",
        "@maven//:junit_junit",
        "@maven//:org_glassfish_grizzly_grizzly_http_server",
        "@maven//:org_glassfish_jersey_core_jersey_client",
        "@maven//:org_glassfish_jersey_core_jersey_server",
        "@maven//:org_glassfish_jersey_media_jersey_media_json_jackson",
        "@maven//:org_glassfish_jersey_test_framework_jersey_test_framework_core",
        "@maven//:org_glassfish_jersey_test_framework_providers_jersey_test_framework_provider_grizzly2",
        "@maven//:org_hamcrest_hamcrest",
    ],
)

pmd_test(
    name = "coordinator_testlib_pmd",
    lib = ":coordinator_testlib",
)

junit_tests(
    name = "coordinator_tests",
    size = "medium",
    srcs = glob(["**/*Test.java"]),
    deps = [
        ":coordinator_testlib",
        "//projects/batfish-common-protocol:common",
        "//projects/batfish-common-protocol/src/test:common_testlib",
        "//projects/batfish-common-protocol/src/test/java/org/batfish/datamodel/questions:TestQuestion",
        "//projects/coordinator",
        "//projects/coordinator/src/main/java/org/batfish/coordinator/version",
        "@maven//:com_fasterxml_jackson_core_jackson_core",
        "@maven//:com_fasterxml_jackson_core_jackson_databind",
        "@maven//:com_google_code_findbugs_jsr305",
        "@maven//:com_google_guava_guava",
        "@maven//:com_google_guava_guava_testlib",
        "@maven//:commons_io_commons_io",
        "@maven//:jakarta_ws_rs_jakarta_ws_rs_api",
        "@maven//:junit_junit",
        "@maven//:org_codehaus_jettison_jettison",
        "@maven//:org_glassfish_jersey_core_jersey_client",
        "@maven//:org_glassfish_jersey_core_jersey_server",
        "@maven//:org_glassfish_jersey_test_framework_jersey_test_framework_core",
        "@maven//:org_hamcrest_hamcrest",
    ],
)
